package com.example.testapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class NormalActivity extends AppCompatActivity {
    private TextView mCxkTv,mJayTv;
    private int ticketCxk,ticketJay;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_normal);
        mCxkTv = findViewById(R.id.tv_cxk);
        mJayTv = findViewById(R.id.tv_jay);

        mCxkTv.setText(String.valueOf(ticketCxk)); // 转成字符串
        mJayTv.setText(String.valueOf(ticketJay));

        findViewById(R.id.btn_cxk).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ticketCxk++;
                mCxkTv.setText(String.valueOf(ticketCxk));
            }
        });
        findViewById(R.id.btn_jay).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ticketJay++;
                mJayTv.setText(String.valueOf(ticketJay));
            }
        });
    }
}